package com.example.module.iot.aws.service;

import lombok.extern.slf4j.Slf4j;
import software.amazon.awssdk.crt.mqtt.MqttMessage;

import java.nio.charset.StandardCharsets;
import java.util.function.Consumer;

@Slf4j
public class AwsMqttMessageConsumer implements Consumer<MqttMessage> {
    @Override
    public void accept(MqttMessage mqttMessage) {
        String payload = new String(mqttMessage.getPayload(), StandardCharsets.UTF_8);
        log.info("收到消息: {}", payload);
    }
}
